﻿using System.ComponentModel;
using FreeSql.DataAnnotations;

namespace CozeDomain.Base
{
    /// <summary>
    /// 基类
    /// </summary>
    public class BaseEntity
    {
        public BaseEntity()
        {
            this.DeleteFlag = false;
            this.CreateTime = DateTime.Now;
            this.Id = D.UtilFreesqlOrm.FreesqlOrm.NewId;
        }

        /// <summary>
        ///主键
        /// </summary>
        [Column(DbType = "varchar", StringLength = 36, IsPrimary = true, IsIdentity = false)]
        [Description("主键")]
        public string? Id { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [Column(DbType = "varchar", StringLength = 64, IsNullable = false)]
        [Description("创建人")]
        public string? CreateUser { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Column(DbType = "datetime", IsNullable = false)]
        [Description("创建时间")]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 修改人
        /// </summary>
        [Column(DbType = "varchar", StringLength = 64, IsNullable = true)]
        [Description("修改人")]
        public string? UpdateUser { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        [Column(DbType = "datetime", IsNullable = true)]
        [Description("修改时间")]
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 是否删除,true：删除，默认false
        /// </summary>
        [Column(DbType = "bit", IsNullable = false)]
        [Description("是否删除")]
        public bool DeleteFlag { get; set; }
    }
}
